'''
Created on 29-05-2012

@author: Magda
'''


class Note(object):
    '''
    classdocs
    '''
    id_note = 0
    topic = ""
    date = ""
    user = ""
    listOfProducts = []

    def __init__(self,id_note,topic,date,user):
        '''
        Constructor
        argumenty: topic - temat notatki (QString)
                   date - data dla ktorej wprowadzamy notke (QDate)
                   listOfProducts - lista produktow do zapisania (List<Product>)
        '''
        self.topic = topic
        self.date = date
        self.user = user
        self.id_note = id_note
        
    def setProducts(self,listOfProducts):
        self.listOfProducts = listOfProducts

    def save(self):
        '''
        zapisuje notatke do bazy
        '''
        print "Zapisuje nowa notatke:"
        print "Temat: " + self.topic
        print "Data:" + self.date.__str__()
        print "Produkty:"
        
        for p in self.listOfProducts:
            print p.name + " " + p.quantity + " " + p.price